package com.teamone.etl.apimanager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.teamone.etl.apimanager.dao.ApiDao;
import com.teamone.etl.apimanager.entity.Api;
import com.teamone.etl.apimanager.request.ApiQuery;
import com.teamone.etl.apimanager.service.ApiService;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 接口表(Api)表服务实现类
 *
 * @author makejava
 * @since 2021-01-20 18:32:03
 */
@Service("apiService")
@Transactional(rollbackFor = Exception.class)
public class ApiServiceImpl extends ServiceImpl<ApiDao, Api> implements ApiService {

    @Override
    public PageInfo<Map<String,Object>> selectAll(ApiQuery apiQuery) {
        PageHelper.startPage(apiQuery.getPageNum(),apiQuery.getPageSize());
        List<Map<String,Object>> apiList=baseMapper.selectAll(apiQuery);
        return new PageInfo<>(apiList);
    }

    @Override
    public void logicDeleteById(Integer id) {
        baseMapper.logicDeleteById(id);
    }

    @Override
    public void updateOne(Api api) {
        baseMapper.updateOne(api);
    }

    @Override
    public void saveOne(Api api) {
        baseMapper.saveOne(api);
    }
}